﻿using Quartz;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Common.Quartz.JobConfig
{
    /// <summary>
    /// 任务配置(基类)
    /// </summary>
    public abstract class BaseJobConfig
    {
        /// <summary>
        /// 添加执行的任务计划
        /// </summary>
        /// <param name="scheduler"></param>
        /// <returns></returns>
        public virtual async Task ScheduleJob(IScheduler scheduler)
        {
            await scheduler.ScheduleJob(JobDetail(), JobTrigger());
        }

        /// <summary>
        /// 任务触发器
        /// </summary>
        /// <returns></returns>
        public abstract ITrigger JobTrigger();

        /// <summary>
        /// 任务详情
        /// </summary>
        /// <returns></returns>
        public abstract IJobDetail JobDetail();
    }
}
